<!--
   _   _                      _                 _
  | | | |                    | |               | |
  | |_| | ___  _ __ ___   ___| | __ _ _ __   __| |
  |  _  |/ _ \| '_ ` _ \ / _ \ |/ _` | '_ \ / _` |
  | | | | (_) | | | | | |  __/ | (_| | | | | (_| |
  \_| |_/\___/|_| |_| |_|\___|_|\__,_|_| |_|\__,_|
  ------------------------------------------------
                            http://gethomeland.com

  - Ruby:  <%= RUBY_VERSION %><%= "-p#{RUBY_PATCHLEVEL}" if defined? RUBY_PATCHLEVEL %>
  - Rails: <%= Rails.version %>
  - Homeland: <%= Homeland.version %>
-->
<!DOCTYPE html>
<html>
<head>
  <meta charset='utf-8' />
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
  <title><%= content_for?(:title) ? yield(:title) : Setting.app_name %></title>
  <link rel="icon" href="<%= asset_path('favicon.png') %>" />
  <meta name="apple-mobile-web-app-capable" content="no">
  <meta content='True' name='HandheldFriendly' />
  <link rel="alternate" type="application/rss+xml" title="订阅最新帖" href="<%= main_app.feed_topics_url %>" />
  <%= stylesheet_link_tag "front", 'data-turbolinks-track': "reload" %>
  <%= stylesheet_link_tag "turbolinks-app", 'data-turbolinks-track': 'reload' if turbolinks_app? %>
  <%= action_cable_meta_tag %>
  <%= csrf_meta_tag %>
  <%= raw Setting.custom_head_html %>
  <% if current_user %>
    <meta name="current-user" data-user-id="<%= current_user.id %>" data-user-login="<%= current_user.login %>" data-user-name="<%= current_user.name %>" data-user-email="<%= current_user.email %>" data-user-avatar-url="<%= current_user.avatar? ? current_user.avatar.url(:md) : current_user.letter_avatar_url(96) %>">
  <% end %>

  <%= javascript_include_tag "app", 'data-turbolinks-track': "reload" %>
</head>
<body class="page-<%= controller_name %><%= ' infinite-scroll' if turbolinks_app? %>" data-controller-name="<%= controller_name %>">
  <div class="header">
    <nav class="navbar navbar-inverse navbar-fixed-top navbar-default">
      <div class="container">
        <div class="navbar-header" id="navbar-header" data-turbolinks-permanent>
          <%= raw Setting.navbar_brand_html %>
        </div>
        <%= yield :header %>
        <%= render "shared/navbar" %>
        <%= render "shared/usernav" %>
      </div>
    </nav>
  </div>

  <%= yield :sub_navbar %>

  <div id="main" class="main-container container">
    <%= birthday_tag %>
    <%= notice_message %>
    <%= yield %>
  </div>

  <% if not mobile? %>
  <footer class="footer" id="footer" data-turbolinks-permanent>
    <div class="container">
      <%= raw Setting.footer_html %>
    </div>
  </footer>
  <% end %>

  <% if mobile? %>
    <script type="text/javascript">
    App.mobile = true;
    </script>
  <% end %>
  <script type="text/javascript" data-turbolinks-eval="false">
    App.root_url = "<%= main_app.root_url %>";
    App.asset_url = "<%= Setting.upload_url -%>";
    App.twemoji_url = "<%= Twemoji.configuration.asset_root %>";
    App.locale = "<%= I18n.locale %>";
    <% if current_user %>
      App.current_user_id = <%= current_user.id %>;
    <% end %>
    <% if turbolinks_app? %>
      App.turbolinks = true;
    <% end %>
  </script>
  <%= yield :scripts %>
  <script>
    ga('create', '<%= Setting.google_analytics_key %>', 'auto');
    ga('require', 'displayfeatures');
    ga('send', 'pageview');
  </script>
  <div class="zoom-overlay"></div>
</body>
</html>
